package com.sdk.ks;

import com.sdk.config.TokenConfig;
import jakarta.annotation.PostConstruct;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;

import java.util.HashMap;
import java.util.Map;

@Component
public class KSConfig {
    public static final Map<String, String> ksConfigMap = new HashMap<>();
    public static String gift_ids;
    public static String appId;
    public static String secret;
    public static String dbFlag;

    @Value("${game.params.kuaishou.app-id}")
    public String getAppId;

    @Value("${game.params.kuaishou.secret}")
    public String getSecret;

    @Value("${game.params.kuaishou.test-code}")
    public String testRoomCode;

    @Value("${spring.application.name}")
    public String name;

    @PostConstruct
    public void init() {
        appId = this.getAppId;
        secret = this.getSecret;
        ksConfigMap.put(appId, secret);
        dbFlag = this.name + "_ks_" + appId;

        TokenConfig.ks_token = getSecret;
    }
}
